package thread;

/**
 * @author tongchen
 * @create 2023-01-07 22:23
 */
public class ThreadSafety {
    public static int count=0;
    public synchronized static void increase(){
        for(int i=0;i<50000;++i){
            count++;
        }
    }
    public static void main(String[] args) throws InterruptedException {
        //创建线程1
       Thread thread= new Thread(()->{
            increase();
        });
        thread.start();
        increase();

        thread.join();
        System.out.println(count);
    }
}
